package com.ht.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ht.domain.bo.TbJuniorBO;
import com.ht.domain.po.TbJunior;
import com.ht.mapper.TbJuniorMapper;
import com.ht.service.TbJuniorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class TbJuniorServiceImpl implements TbJuniorService {
    @Autowired
    private TbJuniorMapper tbJuniorMapper;

    @Override
    public List<TbJuniorBO> queryByJunior(Long departmentId) {
        QueryWrapper<TbJunior> q = new QueryWrapper<>();
        q.eq("department_id",departmentId);
        List<TbJunior> list = tbJuniorMapper.selectList(q);
        List<TbJuniorBO> listt = new ArrayList<>();
        list.forEach(obj->{
            TbJuniorBO bo = new TbJuniorBO();
            BeanUtil.copyProperties(obj,bo);
            listt.add(bo);
        });
        return listt;
    }
}
